package views
{
import org.robotlegs.mvcs.Mediator;

import views.events.UiControlEvent;

/**
 * author yangwz
 */		
public class UiControlViewMediator extends Mediator
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>UiControlViewMediator</code> instance.
	 * 
	 */
	public function UiControlViewMediator()
	{
		super();
	}
	//==========================================================================
	//  Properties
	//==========================================================================
	public function get view():UiControlView
	{
		return viewComponent as UiControlView;
	}
	//==========================================================================
	//  Methods
	//==========================================================================
	/**
	 * @inheritDoc
	 */
	override public function onRegister():void
	{
		addViewListener(UiControlEvent.Instructions, instructionsHandler);
		addViewListener(UiControlEvent.PLAY, playHandler);
	}
	
	/**
	 * @inheritDoc
	 */
	override public function onRemove():void
	{
		super.onRemove();
		
	}
	//==========================================================================
	//  Event Handlers
	//==========================================================================
	private function playHandler(event:UiControlEvent):void
	{
		trace("play");
	}
	
	private function instructionsHandler(event:UiControlEvent):void
	{
		trace("instructions");
		dispatch(event.clone());
	}
}
}